package com.wang.jmonkey.ca.handler.login;

import com.wang.jmonkey.ca.filter.GeneralAuthenticationFilter;
import com.wang.jmonkey.ca.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.stereotype.Component;

/**
 * @Description 普通登陆
 * @Author HeJiawang
 * @Date 2021/5/11 17:40
 */
@Component
public class GeneralServiceHandler implements UserServiceHandlerAdapter {

    @Autowired
    private SystemUserService systemUserService;

    @Override
    public UserDetails handler(String username) {
        return systemUserService.selectLoginUser(username);
    }

    @Override
    public boolean support(AbstractAuthenticationProcessingFilter filter) {
        return filter instanceof GeneralAuthenticationFilter;
    }
}
